runOnStartup(async runtime => {
    runtime.objects.f_DistanceFromPl.addEventListener("instancecreate", (e) => {
        
        
        console.log("distance")
        runtime.addEventListener("tick", () => {
            var pl = runtime.objects.Pl?.getFirstInstance()
            if (pl == null) return
            for (let Diss of runtime.objects.f_DistanceFromPl.instances()) {
                /**@type {IObjectClass} */
                var diss_ = Diss
                var distance_ = lib._Math.distance(diss_.x, diss_.y, pl.x, pl.y)
                diss_.instVars.Distance = distance_
            }
                    
          
        })
    })
})